#include <SPI.h>
#include <TimeLib.h>
#include <U8g2lib.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
#include <DNSServer.h>
#include <WiFiUdp.h>
#include <ArduinoJson.h>
//配置显示
U8G2_ST7567_OS12864_F_4W_HW_SPI u8g2(U8G2_R2, /* cs=*/5, /* dc=*/15, /* reset=*/4);

WiFiUDP Udp;
unsigned int localPort = 8888; /* 用于侦听UDP数据包的本地端口 */

/* 网络校时的相关配 */
static const char ntpServerName[] = "ntp1.aliyun.com"; /* NTP服务器使用阿里云 */
int timeZone = 8;                                      /* 时区设置采用8 */

char dayFlag;
int picIndex;
//时间
int years, months, days, hours, minutes, seconds, weekdays;


boolean isNTPConnected = false;

const unsigned char xing[] U8X8_PROGMEM = {
  0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0x80, 0x00, 0x88, 0x00,
  0xF8, 0x1F, 0x84, 0x00, 0x82, 0x00, 0xF8, 0x0F, 0x80, 0x00, 0x80, 0x00, 0xFE, 0x3F, 0x00, 0x00
}; /**/
const unsigned char liu[] U8X8_PROGMEM = {
  0x40, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00,
  0x20, 0x02, 0x20, 0x04, 0x10, 0x08, 0x10, 0x10, 0x08, 0x10, 0x04, 0x20, 0x02, 0x20, 0x00, 0x00
}; /**/

// width: 55, height: 56
const unsigned char a[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x8c, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x8c, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x0e, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x60, 0x0c, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x60, 0x18, 0x18, 0x07, 0x00, 0x00, 0x00, 0x30, 0x30, 0x18, 0x06, 0x00, 0x00, 0x00, 0x30, 0x60, 0x18, 0x06, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x30, 0x06, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x30, 0x06, 0x00, 0x00, 0x00, 0xc0, 0x80, 0x71, 0x0c, 0x00, 0x00, 0x00, 0x80, 0x81, 0x7f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xe0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x40, 0x06, 0x00, 0x40, 0x00, 0x98, 0x01, 0x00, 0x04, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x1c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x70, 0x30, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x7c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x1c, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x22, 0x03, 0x00, 0x00, 0x00, 0x10, 0x52, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x43, 0x41, 0x03, 0x00, 0x00, 0x00, 0x18, 0x21, 0x4f, 0x03, 0x00, 0x00, 0x00, 0x18, 0x20, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char b[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x80, 0x63, 0x00, 0x00, 0x00, 0xe1, 0x01, 0x80, 0x61, 0x00, 0x00, 0x00, 0x81, 0x07, 0x80, 0x71, 0x00, 0x00, 0x80, 0x01, 0x0e, 0xc0, 0x31, 0x00, 0x00, 0x00, 0x03, 0x1c, 0xc0, 0x38, 0x00, 0x00, 0x00, 0x07, 0x30, 0xc0, 0x1c, 0x00, 0x00, 0x00, 0x0e, 0x20, 0x7e, 0x0c, 0x00, 0x00, 0x00, 0x3c, 0x40, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xf8, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0xe0, 0xc7, 0x1f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0xee, 0x03, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x38, 0xe0, 0x03, 0x00, 0x80, 0x01, 0x00, 0x38, 0xe0, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x18, 0x60, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x00, 0x06, 0x00, 0x40, 0x00, 0x98, 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x08, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x70, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x3e, 0x03, 0x00, 0x00, 0x00, 0x70, 0x38, 0x62, 0x03, 0x00, 0x00, 0x00, 0x30, 0x4c, 0x42, 0x03, 0x00, 0x00, 0x00, 0x18, 0x80, 0x96, 0x03, 0x00, 0x00, 0x00, 0x18, 0x82, 0x85, 0x03, 0x00, 0x00, 0x00, 0x18, 0xd2, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x72, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char c[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x00, 0x00, 0xff, 0x00, 0x00, 0x78, 0x38, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x38, 0x1c, 0x00, 0x80, 0x01, 0x3f, 0x00, 0x1c, 0x0e, 0x00, 0x80, 0x01, 0x70, 0x00, 0x06, 0x07, 0x00, 0x80, 0x01, 0xc0, 0xf1, 0xc3, 0x01, 0x00, 0x80, 0x03, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xfe, 0x87, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf8, 0xff, 0x03, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xe0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x40, 0x06, 0x00, 0x40, 0x00, 0x98, 0x01, 0x00, 0x04, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x1c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x70, 0x30, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x7c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x1c, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x22, 0x03, 0x00, 0x00, 0x00, 0x10, 0x52, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x43, 0x41, 0x03, 0x00, 0x00, 0x00, 0x18, 0x21, 0x4f, 0x03, 0x00, 0x00, 0x00, 0x18, 0x20, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char d[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x81, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x7d, 0xc0, 0x00, 0x00, 0x00, 0xf0, 0xf8, 0x1d, 0x70, 0x00, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x3c, 0x00, 0x00, 0xf0, 0x03, 0xf0, 0xff, 0x3f, 0x00, 0x00, 0x38, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x0c, 0xc0, 0x3f, 0xf8, 0x07, 0x00, 0x00, 0x0c, 0xe0, 0x01, 0x00, 0x0f, 0x00, 0x00, 0x18, 0xf0, 0x01, 0x00, 0x3c, 0x00, 0x00, 0x30, 0xf8, 0x00, 0x00, 0x70, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x38, 0xe0, 0x03, 0x00, 0x80, 0x01, 0x00, 0x38, 0xe0, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x18, 0x60, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x00, 0x06, 0x00, 0x40, 0x00, 0x98, 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x08, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x70, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x3e, 0x03, 0x00, 0x00, 0x00, 0x70, 0x38, 0x62, 0x03, 0x00, 0x00, 0x00, 0x30, 0x4c, 0x42, 0x03, 0x00, 0x00, 0x00, 0x18, 0x80, 0x96, 0x03, 0x00, 0x00, 0x00, 0x18, 0x82, 0x85, 0x03, 0x00, 0x00, 0x00, 0x18, 0xd2, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x72, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char e[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x0e, 0x08, 0xfc, 0xe0, 0x01, 0x00, 0x00, 0x07, 0x04, 0x30, 0xfc, 0x01, 0x00, 0x80, 0x03, 0x04, 0x00, 0x88, 0x03, 0x00, 0xc0, 0x01, 0x06, 0x00, 0x00, 0x03, 0x00, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x06, 0x00, 0xc0, 0xc0, 0x01, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0xe1, 0x00, 0x38, 0xe0, 0x06, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x40, 0x06, 0x00, 0x40, 0x00, 0x98, 0x01, 0x00, 0x04, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x1c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x70, 0x30, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x7c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x1c, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x22, 0x03, 0x00, 0x00, 0x00, 0x10, 0x52, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x43, 0x41, 0x03, 0x00, 0x00, 0x00, 0x18, 0x21, 0x4f, 0x03, 0x00, 0x00, 0x00, 0x18, 0x20, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char f[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0xe6, 0x07, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xc3, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x20, 0x82, 0x3d, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x86, 0x71, 0x00, 0x00, 0x00, 0x64, 0x00, 0x0e, 0xe0, 0x00, 0x00, 0x00, 0x62, 0x00, 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x31, 0x00, 0x38, 0xe0, 0x03, 0x00, 0x80, 0x19, 0x00, 0x38, 0xe0, 0x03, 0x00, 0xc0, 0x18, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x18, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x18, 0x60, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x00, 0x06, 0x00, 0x40, 0x00, 0x98, 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x08, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x70, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x3e, 0x03, 0x00, 0x00, 0x00, 0x70, 0x38, 0x62, 0x03, 0x00, 0x00, 0x00, 0x30, 0x4c, 0x42, 0x03, 0x00, 0x00, 0x00, 0x18, 0x80, 0x96, 0x03, 0x00, 0x00, 0x00, 0x18, 0x82, 0x85, 0x03, 0x00, 0x00, 0x00, 0x18, 0xd2, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x72, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char g[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xef, 0x07, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x66, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x38, 0x07, 0x38, 0x70, 0x00, 0x00, 0x00, 0x04, 0x1c, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x10, 0x30, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x01, 0x20, 0x00, 0x80, 0x03, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xe0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x40, 0x06, 0x00, 0x40, 0x00, 0x98, 0x01, 0x00, 0x04, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x1c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x70, 0x30, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x7c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x1c, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x22, 0x03, 0x00, 0x00, 0x00, 0x10, 0x52, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x43, 0x41, 0x03, 0x00, 0x00, 0x00, 0x18, 0x21, 0x4f, 0x03, 0x00, 0x00, 0x00, 0x18, 0x20, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char h[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf2, 0xff, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xe0, 0x3d, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x38, 0xe0, 0x03, 0x00, 0x80, 0x01, 0x00, 0x38, 0xe0, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x18, 0x60, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x00, 0x06, 0x00, 0x40, 0x00, 0x98, 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x08, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x70, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x3e, 0x03, 0x00, 0x00, 0x00, 0x70, 0x38, 0x62, 0x03, 0x00, 0x00, 0x00, 0x30, 0x4c, 0x42, 0x03, 0x00, 0x00, 0x00, 0x18, 0x80, 0x96, 0x03, 0x00, 0x00, 0x00, 0x18, 0x82, 0x85, 0x03, 0x00, 0x00, 0x00, 0x18, 0xd2, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x72, 0x04, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
const unsigned char i[] U8X8_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x08, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xe0, 0x1b, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x0c, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x38, 0x04, 0x00, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xf0, 0x06, 0x00, 0xc0, 0x00, 0x00, 0x38, 0xe0, 0x06, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x40, 0x00, 0x20, 0x03, 0x00, 0x07, 0x00, 0x40, 0x00, 0xb0, 0x01, 0x40, 0x06, 0x00, 0x40, 0x00, 0x98, 0x01, 0x00, 0x04, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x1c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x70, 0x30, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x7c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x1c, 0x03, 0x00, 0x00, 0x00, 0x70, 0x46, 0x22, 0x03, 0x00, 0x00, 0x00, 0x10, 0x52, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x43, 0x41, 0x03, 0x00, 0x00, 0x00, 0x18, 0x21, 0x4f, 0x03, 0x00, 0x00, 0x00, 0x18, 0x20, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x03, 0x00 };
//width:55,height:64
const unsigned char col0[] U8X8_PROGMEM = { 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x60, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x80, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x10, 0x00, 0x00, 0x04, 0x00, 0x18, 0x0c, 0x18, 0x00, 0x00, 0x0c, 0x00, 0x30, 0x06, 0x18, 0x00, 0x00, 0x0c, 0x00, 0x30, 0x06, 0x18, 0x00, 0x00, 0x0c, 0x00, 0x30, 0x06, 0x18, 0x00, 0x00, 0x0c, 0x00, 0x30, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x60, 0x83, 0x04, 0x0c, 0x06, 0xa4, 0x00, 0x60, 0x83, 0x0d, 0x8c, 0x07, 0x8c, 0x00, 0x60, 0x03, 0x0d, 0xfc, 0x01, 0x08, 0x00, 0x30, 0x03, 0x01, 0x70, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x38, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x78, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x00, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x02, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x06, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x06, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x06, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x60, 0x06, 0x30, 0xcc, 0x00, 0x00, 0x00, 0x60, 0x06, 0x18, 0xcc, 0x00, 0x00, 0x00, 0x60, 0x06, 0x0c, 0xcc, 0x00, 0x00, 0x00, 0x60, 0x06, 0x0e, 0xc6, 0x00, 0x00, 0x00, 0xe0, 0x0c, 0x06, 0x86, 0x01, 0x00, 0x00, 0xc0, 0x18, 0x02, 0x83, 0x03, 0x00, 0x00, 0xe0, 0x19, 0xe7, 0x01, 0x03, 0x00, 0x00, 0xf0, 0xdf, 0xff, 0x00, 0x03, 0x00, 0x00, 0x38, 0xc4, 0x18, 0x00, 0x02, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0c, 0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0c, 0x20, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x18, 0x60, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x38, 0x70, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x8f, 0xff, 0x03, 0x00, 0x00 };


struct _weather { /* 天气结构 */
  int high;       /* 最高温*/
  int low;        /* 最低温*/
  int humidity;   /* 湿度*/
  String wind_direction;
  String text_day;
} WeaToday, WeaMing, WeaHou;

WiFiClient clientNULL;
DNSServer dnsServer;
ESP8266WebServer server(80);

/* ----------天气API配置---------- */
const char* host = "api.seniverse.com"; /* 将要连接的服务器地址 */
const int httpPort = 80;                /* 将要连接的服务器端口 */

/* 心知天气HTTP请求所需信息 */
String reqUserKey = "SB5tNVlkkcFzeyyS-"; /* 私钥 */
String reqLocation = "福建省南平市";     /* 城市 */
String reqUnit = "c";                    /* 摄氏/华氏 */

/* 函数声明 */
time_t getNtpTime();
void showTime();

time_t prevDisplay = 0;

/* 向心知天气服务器服务器请求信息并对信息进行解 */
void httpRequest(String reqRes) {
  WiFiClient client;

  /* 建立http请求信息 */
  String httpRequest = String("GET ") + reqRes + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n";
  /* 尝试连接服务 */
  if (client.connect(host, 80)) {
    /* 向服务器发送http请求信息 */
    client.print(httpRequest);
    client.find("\r\n\r\n");
    getThreeData(client, 1);
  } else {
    client.print(httpRequest);
    client.find("\r\n\r\n");
    getThreeData(client, 0);
  }
  /* 断开客户端与服务器连接工 */
  client.stop();
}



/* 利用ArduinoJson库解析心知天气响应信(预测) */
void getThreeData(WiFiClient client, int i) {
  if (i == 1) {
    const size_t capacity = JSON_ARRAY_SIZE(1) + JSON_ARRAY_SIZE(3) + JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(6) + 3 * JSON_OBJECT_SIZE(14) + 860;

    DynamicJsonDocument doc(capacity);


    deserializeJson(doc, client);

    JsonObject results_0 = doc["results"][0];

    JsonArray results_0_daily = results_0["daily"];
    /**********今天****************/
    JsonObject results_0_daily_0 = results_0_daily[0];
    const char* results_0_daily_0_date = results_0_daily_0["date"];
    const char* results_0_daily_0_text_day = results_0_daily_0["text_day"];
    const char* results_0_daily_0_code_day = results_0_daily_0["code_day"];
    const char* results_0_daily_0_text_night = results_0_daily_0["text_night"];
    const char* results_0_daily_0_code_night = results_0_daily_0["code_night"];
    const char* results_0_daily_0_high = results_0_daily_0["high"];
    const char* results_0_daily_0_low = results_0_daily_0["low"];
    const char* results_0_daily_0_rainfall = results_0_daily_0["rainfall"];                            //降水量单位mm
    const char* results_0_daily_0_precip = results_0_daily_0["precip"];                                //降水概率目前不支
    const char* results_0_daily_0_wind_direction = results_0_daily_0["wind_direction"];                //风向文字
    const char* results_0_daily_0_wind_direction_degree = results_0_daily_0["wind_direction_degree"];  //风向角度范围0~360
    const char* results_0_daily_0_wind_speed = results_0_daily_0["wind_speed"];                        //风速单位km/h(当unit=c)、mph(当unit=f)
    const char* results_0_daily_0_wind_scale = results_0_daily_0["wind_scale"];                        //风力等级
    const char* results_0_daily_0_humidity = results_0_daily_0["humidity"];                            //相对湿度0~100单位为百分比
                                                                                                       /**********明天****************/
    JsonObject results_0_daily_1 = results_0_daily[1];
    const char* results_0_daily_1_date = results_0_daily_1["date"];
    const char* results_0_daily_1_text_day = results_0_daily_1["text_day"];
    const char* results_0_daily_1_code_day = results_0_daily_1["code_day"];
    const char* results_0_daily_1_text_night = results_0_daily_1["text_night"];
    const char* results_0_daily_1_code_night = results_0_daily_1["code_night"];
    const char* results_0_daily_1_high = results_0_daily_1["high"];
    const char* results_0_daily_1_low = results_0_daily_1["low"];
    const char* results_0_daily_1_rainfall = results_0_daily_1["rainfall"];
    const char* results_0_daily_1_precip = results_0_daily_1["precip"];
    const char* results_0_daily_1_wind_direction = results_0_daily_1["wind_direction"];
    const char* results_0_daily_1_wind_direction_degree = results_0_daily_1["wind_direction_degree"];
    const char* results_0_daily_1_wind_speed = results_0_daily_1["wind_speed"];
    const char* results_0_daily_1_wind_scale = results_0_daily_1["wind_scale"];
    const char* results_0_daily_1_humidity = results_0_daily_1["humidity"];
    /**********后天****************/
    JsonObject results_0_daily_2 = results_0_daily[2];
    const char* results_0_daily_2_date = results_0_daily_2["date"];
    const char* results_0_daily_2_text_day = results_0_daily_2["text_day"];
    const char* results_0_daily_2_code_day = results_0_daily_2["code_day"];
    const char* results_0_daily_2_text_night = results_0_daily_2["text_night"];
    const char* results_0_daily_2_code_night = results_0_daily_2["code_night"];
    const char* results_0_daily_2_high = results_0_daily_2["high"];
    const char* results_0_daily_2_low = results_0_daily_2["low"];
    const char* results_0_daily_2_rainfall = results_0_daily_2["rainfall"];
    const char* results_0_daily_2_precip = results_0_daily_2["precip"];
    const char* results_0_daily_2_wind_direction = results_0_daily_2["wind_direction"];
    const char* results_0_daily_2_wind_direction_degree = results_0_daily_2["wind_direction_degree"];
    const char* results_0_daily_2_wind_speed = results_0_daily_2["wind_speed"];
    const char* results_0_daily_2_wind_scale = results_0_daily_2["wind_scale"];
    const char* results_0_daily_2_humidity = results_0_daily_2["humidity"];

    const char* results_0_last_update = results_0["last_update"];
    //明天天气
    WeaMing.high = results_0_daily_1["high"].as<int>();
    WeaMing.low = results_0_daily_1["low"].as<int>();
    WeaMing.humidity = results_0_daily_1["humidity"].as<int>();
    WeaMing.wind_direction = results_0_daily_1["wind_direction"].as<String>();
    WeaMing.text_day = results_0_daily_1["text_day"].as<String>();
    //后天天气
    WeaHou.high = results_0_daily_2["high"].as<int>();
    WeaHou.low = results_0_daily_2["low"].as<int>();
    WeaHou.humidity = results_0_daily_2["humidity"].as<int>();
    WeaHou.wind_direction = results_0_daily_2["wind_direction"].as<String>();
    WeaHou.text_day = results_0_daily_2["text_day"].as<String>();
    //今天天气
    WeaToday.high = results_0_daily_0["high"].as<int>();
    WeaToday.low = results_0_daily_0["low"].as<int>();
    WeaToday.humidity = results_0_daily_0["humidity"].as<int>();
    WeaToday.wind_direction = results_0_daily_0["wind_direction"].as<String>();
    WeaToday.text_day = results_0_daily_0["text_day"].as<String>();

  } else {
    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_pressstart2p_8f);
    u8g2.setCursor(0, 8);
    u8g2.print("Failded");
    u8g2.sendBuffer();
  }
}

void setup() {
  u8g2.begin();
  u8g2.enableUTF8Print();
  u8g2.clearBuffer();
  WiFiManager wm;
  bool res;
  res = wm.autoConnect("SmartClock");

  if (!res) {
    u8g2.setFont(u8g2_font_unifont_t_chinese2);
    u8g2.setCursor(0, 13);
    u8g2.print("网络连接失败");
    u8g2.setCursor(0, 26);
    u8g2.print("准备重新连接...");
    u8g2.sendBuffer();
    delay(300);
    ESP.restart();
  } else {
    u8g2.setFont(u8g2_font_unifont_t_chinese2);
    u8g2.setCursor(0, 14);
    u8g2.print("网络连接成功");
    u8g2.sendBuffer();
    u8g2.clearBuffer();
  }
  /* 同步对时间每300秒同步一次时 */
  Udp.begin(localPort);
  setSyncProvider(getNtpTime);
  setSyncInterval(300);
  delay(200);
  dayFlag = day();

  delay(200);
  years = year();
  months = month();
  days = day();
  hours = hour();
  minutes = minute();
  seconds = second();
  weekdays = weekday();
  WeaToday.low = 0;
  WeaMing.low = 0;
  WeaHou.low = 0;
  RequestThreeDayData();
}




void loop() {
  updateLocalTime();
  u8g2.clearBuffer();
  ifAnewDay();
  showTodayWea();
  showTime();
  drawBiaoQing();
  u8g2.sendBuffer();
  delay(100);
}

/*-------- NTP 代码 ----------*/
const int NTP_PACKET_SIZE = 48;     /* NTP时间在消息的48个字节里 */
byte packetBuffer[NTP_PACKET_SIZE]; /* 输入输出包的缓冲 */

/* 获取时间 */
time_t getNtpTime() {
  IPAddress ntpServerIP; /* NTP服务器的地址 */

  while (Udp.parsePacket() > 0)
    ; /* 丢弃以前接收的任何数据包 */
  //Serial.println( "Transmit NTP Request" );
  /* 从池中获取随机服务器 */
  WiFi.hostByName(ntpServerName, ntpServerIP);
  //Serial.print( ntpServerName );
  //Serial.print( ": " );
  //Serial.println( ntpServerIP );
  sendNTPpacket(ntpServerIP);
  uint32_t beginWait = millis();
  while (millis() - beginWait < 1500) {
    int size = Udp.parsePacket();
    if (size >= NTP_PACKET_SIZE) {
      //Serial.println( "Receive NTP Response" );
      isNTPConnected = true;
      Udp.read(packetBuffer, NTP_PACKET_SIZE); /* 将数据包读取到缓冲区 */
      unsigned long secsSince1900;
      /* 将从位置40开始的四个字节转换为长整型只取32位整数部 */
      secsSince1900 = (unsigned long)packetBuffer[40] << 24;
      secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
      secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
      secsSince1900 |= (unsigned long)packetBuffer[43];
      //Serial.println( secsSince1900 );
      //Serial.println( secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR );
      return (secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR);
    }
  }
  //Serial.println( "No NTP Response :-(" );        /* 无NTP响应 */
  isNTPConnected = false;
  return (0); /* 如果未得到时间则返回0 */
}


/* 向给定地址的时间服务器发送NTP请求 */
void sendNTPpacket(IPAddress& address) {
  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  packetBuffer[0] = 0b11100011; /* LI, Version, Mode */
  packetBuffer[1] = 0;          /* Stratum, or type of clock */
  packetBuffer[2] = 6;          /* Polling Interval */
  packetBuffer[3] = 0xEC;       /* Peer Clock Precision */
  /* 8 bytes of zero for Root Delay & Root Dispersion */
  packetBuffer[12] = 49;
  packetBuffer[13] = 0x4E;
  packetBuffer[14] = 49;
  packetBuffer[15] = 52;
  Udp.beginPacket(address, 123); /* NTP需要使用的UDP端口号为123 */
  Udp.write(packetBuffer, NTP_PACKET_SIZE);
  Udp.endPacket();
}

/**显示时间**/
void showTime() {
  String dataStr = "";
  String timeStr = "";
  u8g2.setFont(u8g2_font_missingplanet_tn);
  u8g2.setCursor(0, 9);

  dataStr += years;
  dataStr += "/";
  dataStr += months;
  dataStr += "/";
  dataStr += days;

  timeStr += hours;
  timeStr += ":";
  timeStr += minutes;
  timeStr += ":";
  timeStr += seconds;
  u8g2.print(dataStr);
  u8g2.setFont(u8g2_font_smart_patrol_nbp_tn);
  u8g2.setCursor(60, 35);
  u8g2.print(timeStr);
  u8g2.setCursor(0, 61);
  u8g2.setFont(u8g2_font_unifont_t_chinese2);
  u8g2.drawXBM(80, 48, 16, 16, xing);
  u8g2.setCursor(95, 62);
  u8g2.print("期");
  if (weekdays == 1)
    u8g2.print("日");
  else if (weekdays == 2)
    u8g2.print("一");
  else if (weekdays == 3)
    u8g2.print("三");
  else if (weekdays == 4)
    u8g2.print("四");
  else if (weekdays == 5)
    u8g2.print("五");
  else if (weekdays == 6)
    u8g2.print("六");
  else if (weekdays == 7)
    u8g2.drawXBM(111, 49, 16, 16, liu);
}


//主页
void mainPage() {
}
//今天天气
void showTodayWea() {
  u8g2.setFont(u8g2_font_DigitalDiscoThin_tf);
  u8g2.setCursor(64, 9);
  u8g2.print(WeaToday.text_day);

  u8g2.setCursor(60, 23);
  u8g2.print(WeaToday.low);

  u8g2.setCursor(72, 23);
  u8g2.print('-');
  u8g2.setCursor(78, 23);
  u8g2.print(WeaToday.high);

  u8g2.setCursor(90, 23);
  u8g2.print('H');

  u8g2.setCursor(98, 23);
  u8g2.print(WeaToday.humidity);
  u8g2.setCursor(116, 23);
  u8g2.print('%');
}
//明天天气
//后天天气
//是否为同一天是则不刷新
void ifAnewDay() {
  if (!dayFlag == day()) {
    RequestThreeDayData();
  }
}

void showThreeDay() {
  //今天
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_DigitalDiscoThin_tf);
  u8g2.setCursor(0, 8);
  u8g2.print(WeaToday.humidity);
  u8g2.setCursor(0, 16);
  u8g2.print(WeaToday.high);
  u8g2.setCursor(0, 24);
  u8g2.print(WeaToday.low);
  //明天
  u8g2.setCursor(30, 8);
  u8g2.print(WeaMing.humidity);
  u8g2.setCursor(30, 16);
  u8g2.print(WeaMing.high);
  u8g2.setCursor(30, 24);
  u8g2.print(WeaMing.low);
  //后天
  u8g2.setCursor(0, 38);
  u8g2.print(WeaHou.humidity);
  u8g2.setCursor(0, 46);
  u8g2.print(WeaHou.high);
  u8g2.setCursor(0, 54);
  u8g2.print(WeaHou.low);
  u8g2.sendBuffer();
}

//得到3天的数据并保
void RequestThreeDayData() {
  /* 建立心知天气API当前天气请求资源地址 */
  String reqRes = "/v3/weather/daily.json?key=" + reqUserKey + +"&location=" + reqLocation + "&language=en&unit=" + reqUnit + "&start=0&days=3";
  /* 向心知天气服务器服务器请求信息并对信息进行解 */
  httpRequest(reqRes);
}

//TODO
/***
启动的时 将年月日时秒分存起来每次循环先检测分钟是否变化若变化则改变分钟的值然后直接跳
*/
//更新本地的时
void updateLocalTime() {
  picIndex++;
  seconds = second();
  if (minutes == minute()) {
    ;
    //什么都不干
  } else if (hours == hour()) {
    minutes = minute();
  } else if (days == day()) {
    hours = hour();
  } else if (months == month()) {
    days = day();
  } else if (years == year()) {
    months = month();
  } else {
    years = year();
  }
}

//动画表情
void drawBiaoQing() {

  if (picIndex == 9) { picIndex = 0; }
  switch (picIndex) {
    case 0:
      u8g2.drawXBMP(0, 10, 55, 56, a);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 1:
      u8g2.drawXBMP(0, 10, 55, 56, b);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 2:
      u8g2.drawXBMP(0, 10, 55, 56, c);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 3:
      u8g2.drawXBMP(0, 10, 55, 56, d);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 4:
      u8g2.drawXBMP(0, 10, 55, 56, e);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 5:
      u8g2.drawXBMP(0, 10, 55, 56, f);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 6:
      u8g2.drawXBMP(0, 10, 55, 56, g);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 7:
      u8g2.drawXBMP(0, 10, 55, 56, h);  //50,50为图片尺寸根据你的图片尺寸修
      break;
    case 8:
      u8g2.drawXBMP(0, 10, 55, 56, i);  //50,50为图片尺寸根据你的图片尺寸修
      break;
  }
  // picIndex++;
}